import { createRouter, createWebHistory } from 'vue-router'

import LoginView from '@/views/Login.vue'
import HomeView from '@/views/Home.vue'
import Settings from "@/views/settings.vue"
import Dashboard from '@/views/Dashboard.vue'
import Generate from '@/views/Generate.vue'
import Library from '@/views/Library.vue'
import Discover from '@/views/Discover.vue'
import Templates from '@/views/Templates.vue'
import YouTube from '@/views/YouTube.vue'
import Instagram from '@/views/Instagram.vue'
import TikTok from '@/views/TikTok.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
      {
        path: '/',
        redirect: '/home/dashboard'
      },
      {
        path: '/login',
        name: 'login',
        component:LoginView,
      },
      {
          path:'/register',
          name:'register',
          component:()=>import('@/views/Register.vue'),
      },
      {
        path: '/home',
        name: 'home',
        component: HomeView,
        redirect: '/home/dashboard', // 添加重定向到dashboard
        children:[
            {
                path: 'dashboard',
                name: 'dashboard',
                component: Dashboard
            },
            {
                path: 'generate',
                name: 'generate',
                component: Generate
            },
            {
                path: 'library',
                name: 'library',
                component: Library
            },
            {
                path: 'discover',
                name: 'discover',
                component: Discover
            },
            {
                path: 'templates',
                name: 'templates',
                component: Templates
            },
            {
                path: 'youtube',
                name: 'youtube',
                component: YouTube
            },
            {
                path: 'instagram',
                name: 'instagram',
                component: Instagram
            },
            {
                path: 'tiktok',
                name: 'tiktok',
                component: TikTok
            },
            {
                path:'settings',
                name:'settings',
                component:Settings
            }
          ]
      },

  ],
})

export default router
